use serde::Deserialize;
use std::sync::LazyLock;

pub static CONFIG: LazyLock<Config> = LazyLock::new(|| FileDomain::read());

struct FileDomain;

impl FileDomain {
    fn read() -> Config {
        let config = std::fs::read_to_string("config.toml").unwrap();
        let config: Config = toml::from_str(&config).unwrap();
        config
    }
}

#[derive(Deserialize)]
pub struct Config {
    pub read_path: String,
    pub side: Vec<String>,

    pub min_hold_time: i64,

    pub zhi_sun: f64,
    pub zhi_sun_time: i64,

    pub buy_multiple: Option<f64>,
    pub keep_time: Option<i64>,
}
